{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fluid-trash",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "aquatic-egypt",
   "metadata": {},
   "outputs": [],
   "source": [
    "point = np.random.randint(0, 10, 10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "subsequent-gender",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([6, 8, 2, 6, 9, 3, 0, 4, 0, 3])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "point"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "working-kingdom",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['合格', '合格', '不合格', '合格', '合格', '不合格', '不合格', '不合格', '不合格', '不合格'],\n",
       "      dtype='<U3')"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.where(point>5, '合格', '不合格')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "typical-metadata",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.4"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.count_nonzero(np.where(point>5, 1, 0)) / point.size"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
